package com.baiyun.service.impl;

import com.baiyun.entity.User;
import com.baiyun.mapper.UserMapper;
import com.baiyun.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserMapper userMapper;

    /**
     * 查询所有用户
     * @return
     */
    @Override
    public List<User> selectAllUser() {
        return userMapper.selectAlluser();
    }

    /**
     * 添加用户
     * @param user
     */
    @Override
    public void addUser(User user) {
        userMapper.addUser(user);
    }

    /**
     * 更新用户
     * @param user
     */
    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    /**
     * 删除用户
     * @param uid
     */
    @Override
    public void deleteUser(Integer uid) {
        userMapper.deleteUser(uid);
    }

    @Override
    public User selectUserById(Integer uid) {
        return userMapper.selectUserById(uid);
    }

    @Override
    public List<User> selectByName(String username) {
        return userMapper.selectByName(username);
    }
}
